***** Replication code for Franchino, Fabio, and Camilla Mariotto. “Noncompliance Risk, Asymmetric Power and the Design of Enforcement of the European Economic Governance”. European Union Politics.

***** Online Appendix Section 4. Tests of two variants of the external constraint expectation
* Table A10: Probing variants of the external constraint expectation
version 15
pause on
use conflict_data_FC2.dta, clear

* Generalized structural equation model: Three-levels, Random intercepts (Table 1)
gsem (discr_com <- c.debt_gdp c.nbi c.nbi#c.debt_gdp i.eurozone i.crisis@0 i.cou_pres c.gov_lr c.gov_eu c.goodEU_net_6 i.comm_s M1[act] M2[act>issue_id], ologit ) ///
	 (discr_cou <- c.debt_gdp c.nbi c.nbi#c.debt_gdp i.eurozone i.crisis@0 i.cou_pres c.gov_lr c.gov_eu c.goodEU_net_6 i.comm_s M1[act] M2[act>issue_id], ologit ) ///
     (discr_nat <- c.debt_gdp                        i.eurozone i.crisis   i.cou_pres c.gov_lr c.gov_eu c.goodEU_net_6 i.comm_s M1[act] M2[act>issue_id], ologit ), vce(robust) nolog

drop if e(sample)!=1 /* Drop deleted observations */

* Scatterplots and correlations between Diffuse support, Noncompliance risk, Left-right, Anti-pro EU
pwcorr goodEU_net_6 debt_gdp, star(.01)
sum goodEU_net_6 debt_gdp

scatter goodEU_net_6 debt_gdp, graphregion(fcolor(white)) ytitle("{it:low			Diffuse support			high}") xtitle("{it:Debt/(10*GDP) at negotiations (%)}") msymbol(i) mlabel(discr_nat) mlabposition(0) mlabsize(vsmall) mlabcolor(black) yline(.2952565,lc(black)) xline(65.23472,lc(black)) || lfit goodEU_net_6 debt_gdp, legend(off)

pause /* type q to proceed */

pwcorr goodEU_net_6 gov_eu, star(.01)
sum goodEU_net_6 gov_eu
scatter goodEU_net_6 gov_eu, graphregion(fcolor(white)) ytitle("{it:low			Diffuse support			high}") xtitle("{it:anti			Gov'ts EU attitude			pro}") msymbol(i) mlabel(discr_nat) mlabposition(0) mlabsize(vsmall) mlabcolor(black) yline(.2952565,lc(black)) xline(5.616607,lc(black)) || lfit goodEU_net_6 gov_eu, legend(off)

pause /* type q to proceed */

pwcorr goodEU_net_6 gov_lr, star(.01)
scatter goodEU_net_6 gov_lr, graphregion(fcolor(white)) ytitle("{it:low			Diffuse support			high}") xtitle("{it:left				Gov'ts ideology				right}") msymbol(i) mlabel(discr_nat) mlabposition(0) mlabsize(vsmall) mlabcolor(black) || lfit goodEU_net_6 gov_lr, legend(off)

pause /* type q to proceed */

** Re-running of the model in Table 1 with an added interacting term between Noncompliance risk and Diffuse Support.  
** Table A10: Probing variants of the external constraint expectation (second column)
gsem (discr_com <- c.debt_gdp c.nbi c.nbi#c.debt_gdp i.eurozone i.crisis@0 i.cou_pres c.gov_lr c.gov_eu c.goodEU_net_6 i.comm_s M1[act] M2[act>issue_id], ologit ) ///
	 (discr_cou <- c.debt_gdp c.nbi c.nbi#c.debt_gdp i.eurozone i.crisis@0 i.cou_pres c.gov_lr c.gov_eu c.goodEU_net_6 i.comm_s M1[act] M2[act>issue_id], ologit ) ///
     (discr_nat <- c.debt_gdp                        i.eurozone i.crisis   i.cou_pres c.gov_lr c.gov_eu c.goodEU_net_6 c.debt_gdp#c.goodEU_net_6 i.comm_s M1[act] M2[act>issue_id], ologit ), vce(robust) nolog

pause /* type q to proceed */
	 
* Substantive effects: National Discretion
* Code from Thomas Brambor, William Roberts Clark, Matt Golder, Political Analysis 14: 63-82)
* Effect of more noncompliance risk (debt_gdp) across diffuse support
matrix b=e(b)
matrix list b
scalar b33=b[1,33]
scalar b43=b[1,43]
sca dir
matrix V=e(V)
matrix list V
scalar varb33=V[33,33]
scalar varb43=V[43,43]
scalar covb33b43=V[33,43]
sca dir
gen MVZ=(_n-4)/10
replace MVZ=. if _n>12
gen conbx=b33+b43*MVZ if _n<=12
gen consx=sqrt(varb33+varb43*(MVZ^2)+2*covb33b43*MVZ) if _n<=12
gen ax=1.96*consx
gen upperx=conbx+ax
gen lowerx=conbx-ax
gen where= -0.017
gen pipe = "|" 
egen tag_goodEU_net_6 = tag(goodEU_net_6)
gen yline=0
graph twoway hist goodEU_net_6, width(0.03) percent color(gs14) yaxis(2) ///
		|| scatter where goodEU_net_6 if tag_goodEU_net_6, plotr(m(b 4)) ms(none) mlabcolor(gs5) mlabel(pipe) mlabpos(6) legend(off)  ///
		||   line conbx   MVZ, clpattern(solid) clwidth(medium) clcolor(black) yaxis(1)  ///
        ||   line upperx  MVZ, clpattern(dash) clwidth(thin) clcolor(black)  ///
        ||   line lowerx  MVZ, clpattern(dash) clwidth(thin) clcolor(black)  ///
        ||   line yline  MVZ,  clwidth(thin) clcolor(black) clpattern(solid) || , ///
			 xlabel(-0.2 0 0.2 0.4 0.6 0.8, noticks nogrid labsize(2)) xscale(noline) ylabel(0 0.3 0.6, noticks axis(1) nogrid labsize(2))  ///
		     ylabel(0 3 6, noticks axis(2) nogrid labsize(2)) yscale(noline alt) yscale(noline alt axis(2)) legend(off) ///			 
			 title("" , size(2.5)) xtitle("Low						{it:Diffuse support}						High", size(2.5)) ytitle("Marginal effect of {it:Noncompliance risk} (debt/10*GDP)" , axis(1) size(2.5)) ytitle("" , axis(2) size(2.5)) ///
			 xsca(titlegap(2) r(0 0.8)) ysca(titlegap(2)) scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white)) 

pause /* type q to proceed */
			 
drop MVZ-yline

* Effect of more diffuse support across noncompliance risk (rescaled debt_gdp)
scalar b42=b[1,42]
scalar b43=b[1,43]
sca dir
scalar varb42=V[42,42]
scalar varb43=V[43,43]
scalar covb42b43=V[42,43]
sca dir
generate MVZ=((_n/10)+0.3)
replace  MVZ=. if _n>170
gen conbx=b42+b43*MVZ if _n<=170
gen consx=sqrt(varb42+varb43*(MVZ^2)+2*covb42b43*MVZ) if _n<=170
gen ax=1.96*consx
gen upperx=conbx+ax
gen lowerx=conbx-ax
gen where=-6.2 
gen pipe = "|" 
egen tag_debt_gdp = tag(debt_gdp)
gen yline=0
graph twoway hist debt_gdp, width(2) percent color(gs14) yaxis(2) ///
		|| scatter where debt_gdp if tag_debt_gdp, plotr(m(b 4)) ms(none) mlabcolor(gs5) mlabel(pipe) mlabpos(6) legend(off)  ///
		||   line conbx   MVZ, clpattern(solid) clwidth(medium) clcolor(black) yaxis(1)  ///
        ||   line upperx  MVZ, clpattern(dash) clwidth(thin) clcolor(black)  ///
        ||   line lowerx  MVZ, clpattern(dash) clwidth(thin) clcolor(black)  ///
        ||   line yline  MVZ,  clwidth(thin) clcolor(black) clpattern(solid) || , ///
			 xlabel(5 10 15, noticks nogrid labsize(2)) xscale(noline) ylabel(-6 -4 -2 0 2 4, noticks axis(1) nogrid labsize(2))  ///
		     ylabel(0 10 20 30, noticks axis(2) nogrid labsize(2)) yscale(noline alt) yscale(noline alt axis(2)) legend(off) ///			 
			 title("" , size(2.5)) xtitle("{it:Noncompliance risk} (dept/10*GDP)" , size(2.5)) ytitle("Marginal effect of {it:Diffuse support}" , axis(1) size(2.5)) ytitle("" , axis(2) size(2.5)) ///
			 xsca(titlegap(2) r(0.3 2)) ysca(titlegap(2)) scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white)) 

pause /* type q to proceed */

drop MVZ-yline

** Re-running the model in Table 1 with an added interacting term between Diffuse Support and Government Anti-pro EU Ideology   
** Table A10: Probing variants of the external constraint expectation (third column)
gsem (discr_com <- c.debt_gdp c.nbi c.nbi#c.debt_gdp i.eurozone i.crisis@0 i.cou_pres c.gov_lr c.gov_eu c.goodEU_net_6 i.comm_s M1[act] M2[act>issue_id], ologit ) ///
	 (discr_cou <- c.debt_gdp c.nbi c.nbi#c.debt_gdp i.eurozone i.crisis@0 i.cou_pres c.gov_lr c.gov_eu c.goodEU_net_6 i.comm_s M1[act] M2[act>issue_id], ologit ) ///
     (discr_nat <- c.debt_gdp                        i.eurozone i.crisis   i.cou_pres c.gov_lr c.gov_eu c.goodEU_net_6 c.gov_eu#c.goodEU_net_6 i.comm_s M1[act] M2[act>issue_id], ologit ), vce(robust) nolog

pause /* type q to proceed */

* Substantive effect: National Discretion
* Code from Thomas Brambor, William Roberts Clark, Matt Golder, Political Analysis 14: 63-82)
* Figure A5: Marginal effect of diffuse support on preferring more national discretion, over governments’ EU attitudes	 
matrix b=e(b)
matrix list b
scalar b42=b[1,42]
scalar b43=b[1,43]
sca dir
matrix V=e(V)
matrix list V
scalar varb42=V[42,42]
scalar varb43=V[43,43]
scalar covb42b43=V[42,43]
sca dir
generate MVZ=(_n+3)/10
replace  MVZ=. if _n>70
gen conbx=b42+b43*MVZ if _n<=70
gen consx=sqrt(varb42+varb43*(MVZ^2)+2*covb42b43*MVZ) if _n<=70
gen ax=1.96*consx
gen upperx=conbx+ax
gen lowerx=conbx-ax
gen where=-1.4 
gen pipe = "|" 
egen tag_gov_eu = tag(gov_eu)
gen yline=0
graph twoway hist gov_eu, width(0.5) percent color(gs14) yaxis(2) ///
		|| scatter where gov_eu if tag_gov_eu, plotr(m(b 4)) ms(none) mlabcolor(gs5) mlabel(pipe) mlabpos(6) legend(off)  ///
		||   line conbx   MVZ, clpattern(solid) clwidth(medium) clcolor(black) yaxis(1)  ///
        ||   line upperx  MVZ, clpattern(dash) clwidth(thin) clcolor(black)  ///
        ||   line lowerx  MVZ, clpattern(dash) clwidth(thin) clcolor(black)  ///
        ||   line yline  MVZ,  clwidth(thin) clcolor(black) clpattern(solid) || , ///
			 xlabel(1 3 5 7, noticks nogrid labsize(2)) xscale(noline) ylabel(-2 0 2 4 6 8, noticks axis(1) nogrid labsize(2))  ///
		     ylabel(0 10 20 30, noticks axis(2) nogrid labsize(2)) yscale(noline alt) yscale(noline alt axis(2)) legend(off) ///			 
			 title("" , size(2.5)) xtitle("Anti						{it:Government EU attitude}						Pro" , size(2.5)) ytitle("Marginal effect of {it:Diffuse support}" , axis(1) size(2.5)) ytitle("" , axis(2) size(2.5)) ///
			 xsca(titlegap(2) r(0.3 2)) ysca(titlegap(2)) scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white)) saving(figureA5, replace)

pause /* type q to proceed */			 

drop MVZ-yline

* Figure A6: Marginal effect of governments’ EU attitudes on preferring more national discretion, over diffuse public support 
scalar b41=b[1,41]
scalar b43=b[1,43]
sca dir
scalar varb41=V[41,41]
scalar varb43=V[43,43]
scalar covb41b43=V[41,43]
sca dir
gen MVZ=(_n-4)/10
replace MVZ=. if _n>12
gen conbx=b41+b43*MVZ if _n<=12
gen consx=sqrt(varb41+varb43*(MVZ^2)+2*covb41b43*MVZ) if _n<=12
gen ax=1.96*consx
gen upperx=conbx+ax
gen lowerx=conbx-ax
gen where=-0.88
gen pipe = "|" 
egen tag_goodEU_net_6 = tag(goodEU_net_6)
gen yline=0
graph twoway hist goodEU_net_6, width(0.03) percent color(gs14) yaxis(2) ///
		|| scatter where goodEU_net_6 if tag_goodEU_net_6, plotr(m(b 4)) ms(none) mlabcolor(gs5) mlabel(pipe) mlabpos(6) legend(off)  ///
		||   line conbx   MVZ, clpattern(solid) clwidth(medium) clcolor(black) yaxis(1)  ///
        ||   line upperx  MVZ, clpattern(dash) clwidth(thin) clcolor(black)  ///
        ||   line lowerx  MVZ, clpattern(dash) clwidth(thin) clcolor(black)  ///
        ||   line yline  MVZ,  clwidth(thin) clcolor(black) clpattern(solid) || , ///
			 xlabel(-0.2 0 0.2 0.4 0.6 0.8, noticks nogrid labsize(2)) xscale(noline) ylabel(-1 0 1, noticks axis(1) nogrid labsize(2))  ///
		     ylabel(0 5, noticks axis(2) nogrid labsize(2)) yscale(noline alt) yscale(noline alt axis(2)) legend(off) ///			 
			 title("" , size(2.5)) xtitle("Low						{it:Diffuse support}						High", size(2.5)) ytitle("Marginal effect of {it:Government EU attitude}" , axis(1) size(2.5)) ytitle("" , axis(2) size(2.5)) ///
			 xsca(titlegap(2) r(0 0.8)) ysca(titlegap(2)) scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white)) saving(figureA6, replace)

